<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //登录验证，用户名正确，才进行密码验证
        var users = ['qiang', 'admin', 'root', 'zhang', 'hello'];
        var passes = ['1234', '2234', '8888', '4234', '9999'];
        //root对应密码8888

        var username = window.prompt("请输入用户名:");
        var psw = window.prompt("请输入密码:");

        var userflag = false;

        for (var i = 0; i < username.length; i++) {
            if (username == users[i]) {
                userflag = true;
                break;
            }
        }
        if (userflag) {
            if (psw == passes[i]) {
                document.write('验证成功，密码正确');
            }
            else {
                document.write('密码错误');
            }
        } else {
            document.write('用户不存在');
        }
        document.write('<br>');


        //冒泡排序
        var a = [12, 34, 23, 56, 69, 38, 47, 33, 45, 89, 64];
        for (var i = 0; i < a.length; i++) {
            for (var j = 0; j < a.length - 1; j++) {
                if (a[j + 1] < a[j]) {
                    var temp = a[j + 1];
                    a[j + 1] = a[j];
                    a[j] = temp;
                }
            }
        }
        document.write("冒泡排序:" + a + "<br>");
    </script>
</head>

<body>

</body>

</html>